const mongoose = require('mongoose')

const { Schema, model } = mongoose

//user模型
const bookFileSchema = new Schema({
  __v: {
    type: Number,
    select: false,
  },
  name: { // 文件名称
    type: String,
    required: true,
  },
  introduction: { // 简介
    type: String,
    required: true
  },
  img: { // 封面
    type: String,
    default: ''
  },
  file: { // 文件地址
    type: String,
    required: true,
    select: false,
  },
  user: { // 上传用户
    type: Schema.Types.ObjectId,
    ref: 'User',
  }
}, { timestamps: true })

module.exports = model('bookFile', bookFileSchema)